package accesoDatos;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class adDatos {
	static Connection conexion;
	public static Connection crearConexion(){
		 try
         {
			 //Carga el driver en memoria
			 Class.forName("com.mysql.jdbc.Driver").newInstance();
             //Creamos una conexion
			 conexion=DriverManager.getConnection("jdbc:mysql://localhost/academia?zeroDateTimeBehavior=convertToNull","root","root");		
			return conexion;
         } catch (Exception e) {
			e.printStackTrace();
			conexion = null;
            return conexion;
         }
             
       }
	public static void closeConn()
    {
        try {
			conexion.close();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        conexion = null; 
    }


}
